<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<div class="page_right indexpage_right">
    <div class="indexpage_right_date">
        <p style="background:#f7f7f7; color:#aaa;">* 输入设备简码/IMEI/MAC码可查询该设备收入情况。</p>
        <p style="text-indent:20px;">
            <span>设备简码:</span>
            <input class="index_searchBox" type="text" id="shortCode" placeholder="请输入设备简码">
            <span>IMEI/MAC码:</span>
            <input class="index_searchBox" type="text" id="imei" placeholder="请输入IMEI/MAC码">
            <span>日期:</span>
            <input class="Wdate" type="text"  id="stime" onClick="WdatePicker()" placeholder="yyyy-mm-dd">
            <span>至</span>
            <input class="Wdate" type="text" id="etime" onClick="WdatePicker()" placeholder="yyyy-mm-dd">
            <a style="margin-left:5px;" class="index_search" href="javascript:;">查询</a>
        </p>

        <ul class="timeType">
            <li><a href="javascript:;" class="${cur==1?'cur':''}" >今日</a></li>
            <li><a href="javascript:;" class="${cur==2?'cur':''}" >本周</a></li>
            <li><a href="javascript:;" class="${cur==3?'cur':''}" >本月</a></li>
        </ul>
        <p id="GC_balance_time" style="clear:both;line-height:50px;text-align:center;background:#f7f7f7;">
            ${stime}
            <c:if test="${not empty etime}">
                &nbsp;~&nbsp;&nbsp;${etime}
            </c:if>
        </p>
    </div>
    <div class="indexpage_right_all">
        <div class="indexpage_right_alldv">
            <p class="indexpage_right_total"><span>总收入：</span><span>￥<f id="GC_balance_grossIncome">${AccountSummary.grossIncome}</f></span></p>
<%--
            <p class="indexpage_right_total"><span>线上支付（微信+支付宝）：</span><span>小计：￥<f id="GC_balance_payIncome">${AccountSummary.wechatpayIncome+AccountSummary.alipayIncome}</f></span></p>
--%>
            <p class="indexpage_right_total"><span>线上支付（微信+支付宝）：</span><span>小计：￥<f id="GC_balance_payIncome">${AccountSummary.netpayIncome}</f></span></p>
        </div>
        <p>收入情况</p>
        <ul>

            <li><span>现金</span><br><span><f id="GC_balance_cashIncome">${AccountSummary.cashIncome}</f>元</span></li>
            <li><span>一元硬币</span><br><span><f id="GC_balance_iconIncome">${AccountSummary.iconIncome}</f>元</span></li>
            <li><span>微信</span><br><span><f id="GC_balance_wechatpayIncome">${AccountSummary.wechatpayIncome}</f>元</span></li>
            <li><span>支付宝</span><br><span><f id="GC_balance_alipayIncome">${AccountSummary.alipayIncome}</f>元</span></li>
            <li class="currency"><span>游戏币</span><br><span><f id="GC_balance_gameCoinQuantity">${AccountSummary.gameCoinQuantity}</f></span></li>
            <li style="color:#38adff;"><span>出币</span><br><span><f id="GC_balance_outGameCoinQuantity">${AccountSummary.outGameCoinQuantity}</f></span></li>
            <li><span>出礼品</span><br><span><f id="GC_balance_giftSellQuantity">${AccountSummary.giftSellQuantity}</f></span></li>
            <li><span>远程补币</span><br><span><f id="GC_balance_remotelyOutGameCoinQuantity">${AccountSummary.remotelyOutGameCoinQuantity}</f></span></li>
        </ul>
    </div>
    <div class="indexpage_right_echart">
        <p><span>条形柱状统计图</span>
            <a class="indexpage_echartcut" href="javascript:;">切换查看</a></p>
        <div class="indexpage_echart" id="indexpage_barchart"></div>
        <div class="indexpage_echart" id="indexpage_ratechart"></div>
    </div>

    <div class="indexpage_right_echart">
        <p>折线统计图</p>
        <div class="indexpage_echart" id="indexpage_linechart"></div>
    </div>

    <div class="indexpage_right_echart">
        <p>堆叠条形图</p>
        <ul class="indexpage_stackbarchart_ul">
            <li><a class="cur" href="javascript:;">今日</a></li>
            <li><a href="javascript:;">本周</a></li>
            <li><a href="javascript:;">本月</a></li>
        </ul>
        <div class="indexpage_echart" id="indexpage_stackbarchart"></div>
    </div>

</div>
<script src="${basePath}resources/js/v2/echarts.min.js"></script>
<script src="${basePath}resources/js/v2/accountClick.js"></script>
<script src="${basePath}resources/js/v2/getOption.js"></script>

<script type="application/javascript">
    var uri = "${basePath}v2/factory/account/";
    var place = 0;
    var device = 0;
    $(".timeType a").each(function(n){
        $(this).click(function(){
            getUri2(uri,n);
        });
    });

    var cashIncome = $("#GC_balance_cashIncome").text().replace(/,/g,'');
    var iconIncome = $("#GC_balance_iconIncome").text().replace(/,/g,'');
    var wechatpayIncome = $("#GC_balance_wechatpayIncome").text().replace(/,/g,'');
    var alipayIncome = $("#GC_balance_alipayIncome").text().replace(/,/g,'');
    var gameCoinQuantity = $("#GC_balance_gameCoinQuantity").text().replace(/,/g,'');
    var outGameCoinQuantity = $("#GC_balance_outGameCoinQuantity").text().replace(/,/g,'');
    var giftSellQuantity = $("#GC_balance_giftSellQuantity").text().replace(/,/g,'');
    var remotelyOutGameCoinQuantity = $("#GC_balance_remotelyOutGameCoinQuantity").text().replace(/,/g,'');
    //条形统计图
    var myBarChart=echarts.init(document.getElementById("indexpage_barchart"));
    var barOption = getBarOption(cashIncome,iconIncome,wechatpayIncome,
        alipayIncome,gameCoinQuantity,outGameCoinQuantity,
        giftSellQuantity,remotelyOutGameCoinQuantity
    );
    myBarChart.setOption(barOption);
    //百分比统计图
    var myPieChart=echarts.init(document.getElementById("indexpage_ratechart"));
    var pieOption = getPieOption(cashIncome,iconIncome,wechatpayIncome,alipayIncome);
    myPieChart.setOption(pieOption);
    //折线图
    var dayVal = ${dayVal};
    var dataVal = ${dataVal};
    var myLineChart=echarts.init(document.getElementById("indexpage_linechart"));
    var lineOption = getLineOption(dayVal,dataVal);
    myLineChart.setOption(lineOption);
    //堆叠条形图
    var dayStackVal = ${dayStackVal};
    var weChat = ${weChatVal};
    var aliPay = ${aliPayVal};
    var sumPay = ${sumPayVal};
    var myStackBarChart=echarts.init(document.getElementById("indexpage_stackbarchart"));
    var stackOption = getStackBarOption(dayStackVal,weChat,aliPay,sumPay);
    myStackBarChart.setOption(stackOption);

    //堆叠统计图今日、本周、本月切换
    $("#indexpage_stackbarchart_week, #indexpage_stackbarchart_mouth").hide();
    $(".indexpage_stackbarchart_ul a").each(function(index){
        $(this).on("click", function(){
            getStackBar(index+1);
            $(this).addClass("cur").parent("li").siblings().children("a").removeClass("cur");
            $(this).parents(".indexpage_right_echart").find(".indexpage_echart").eq(index).show().siblings(".indexpage_echart").hide();
        })
    });

    function getStackBar(num){
        var num = num;
        $.ajax({
            url: uri+"search/"+num,
            type: 'POST',
            error: function (response) {
                $errorMsg(response);
            },
            success: function (ret) {
                getStackBarChart1(ret.dayVal,ret.weChatVal,ret.aliPayVal,ret.sumPayVal);
            }
        });
    }

    function getStackBarChart1(dayVal,weChatVal,aliPayVal,sumPayVal){
        var dayVal = dayVal;
        var weChat = weChatVal;
        var aliPay = aliPayVal;
        var sumPay = sumPayVal;
        var myStackBarChart=echarts.init(document.getElementById("indexpage_stackbarchart"));
        var stackOption = getStackBarOption(dayVal,weChat,aliPay,sumPay);
        myStackBarChart.setOption(stackOption);
    }
</script>